/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2024/6/28
 * Time: 11:40
 */

#ifndef HANDCARDAREA_H
#define HANDCARDAREA_H
#include "Card.h"
#include "OverlapLayout.h"

namespace Upgrade {
    class CardUi;
    class OverlapLayout;
    class HandCardArea : public QWidget
    {
    public:
        explicit HandCardArea(QWidget *_parent = nullptr);

        void SetReorderSuit(const QList<CardSuit> & _order,CardSuit _currentSuit);

    public slots:
        void AddWidget(const CardSPtr &_card);
        void DealSelect(CardUi *_card);

    protected:
        void mousePressEvent(QMouseEvent *event) override;
        void mouseReleaseEvent(QMouseEvent *event) override;
        void mouseMoveEvent(QMouseEvent *event) override;

    private:
        int            select_offset_;
        OverlapLayout *main_layout_ {nullptr};
        bool           is_dragging = false;
        QPointF        drag_start, drag_end;
        QList<CardSuit> suit_order_;
        QList<CardSPtr> all_card_;
    };

}// namespace Upgrade

#endif//HANDCARDAREA_H
